home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / comm / fido / listusers.lha / ListUsers.spot
Text File  |  1995-06-27  |  3KB  |  114 lines

  1. /*            -+- ListUsers 1.1 by Anthony Brice -+-                   */
  2.  
  3. /* Call from Spot Arexx menu in any echo - filename will be Users.<echoname> */
  4.  
  5. /*
  6.  
  7. 1.0 Initial Version.
  8.  
  9. 1.1 Updated to use message list window - 10 * as fast at least :)
  10.  
  11.     Fixed the non return to current message if Stop was pressed.
  12.  
  13.     Asks if it should post a message rather than Config option, once it
  14.     has finished executing the script.
  15.  
  16.     Locks GUI while executing, and exits safely if abort is pressed now.
  17.  
  18. */
  19.  
  20. Address SPOT
  21. Options RESULTS
  22.  
  23. /* +++ Configuration Options +++ */
  24.  
  25. Directory='Workbench:Spot/' /* Storage directory of UserLists - must end in / or : */
  26. Addresslist='YES'           /* Set to YES to list addresses or NO for none */
  27. Pad=20                      /* Length of spacing after name for page formatting */
  28. Info='YES'                  /* Set this to YES for header and footer info, or No for none */
  29. Name='All'                  /* Name of reciever of message - if applicable */
  30. Subject='User Listing'      /* Subject of message - if applicable */
  31.  
  32. /* +++ End of Config lines - Edit past here at your own risk +++ */
  33.  
  34. 'progressclose 1'
  35.  
  36. 'messagelist'
  37. Origin='UserList v1.1 by Anthony Brice' 
  38. 'requestresponse TITLE " UserList 1.1 by Anthony Brice - 2:254/255.1" PROMPT "Create a list of all users in this Area?" GADGETS "Yes|Abort"'
  39. If RC=0 then Exit
  40. 'lockgui'
  41. 'getareaname'
  42. AreaName=RESULT
  43. 'getmessagenum'
  44. CurrentMessage=RESULT
  45. 'getnummsgs'
  46. TotalMessages=RESULT
  47. Message=1
  48. Users=0
  49. Added=0
  50.  
  51. 'firstmessage'
  52. 'progressopen TITLE "Creating a Userlist" PROMPT "Please Wait..."'
  53. Requestor=RESULT
  54. FilePath=Directory||"Users."||AreaName
  55. Header='User Listing for Echo: '||AreaName
  56. Footer='Generated by ListUsers.Spot created by Anthony Brice - '
  57. Call Open(Plop,FilePath,"W")
  58. If Info='YES' then do
  59.   Call WriteLN(Plop," ")
  60.   Call WriteLN(Plop,Header)
  61.   Call WriteLN(Plop," ")
  62.   End
  63. Do Until Message=TotalMessages
  64.   'nextmessage'
  65.   Message=Message+1
  66.   'getfrom'
  67.   From=Left(RESULT,pad)
  68.   Out=0
  69.   Do I=0 to Users
  70.     If Name.I = From then Out=1
  71.     End
  72.   If Out=0 then do
  73.     Users=Users+1
  74.     Added=Added+1
  75.     Name.Users=From
  76.     Line=From
  77.     If AddressList='YES' then do
  78.       'getfromaddress'
  79.       FromAddress=RESULT  
  80.       Line=Line||' - Address: '||FromAddress
  81.       End
  82.     Call WriteLN(Plop,Line)
  83.     End
  84.   'progressupdate' Requestor Message TotalMessages 'PROMPT "'added' User(s) added to Names list"'
  85.   If RC>0 then Do
  86.     'progressclose' Requestor
  87.     Call Close(Plop)
  88.     Address Command 'Delete >NIL: 'FilePath
  89.     'gotomessage TO "'CurrentMessage'"'
  90.     'unlockgui'
  91.     Exit 0
  92.     End
  93.   End
  94. If Info='YES' then do
  95.   Call WriteLN(Plop," ")
  96.   Footer=Footer||added||' Users found.'
  97.   Call WriteLN(Plop,Footer)
  98.   Call WriteLN(Plop," ")
  99.   End
  100. Call Close(Plop)
  101. 'progressclose' Requestor
  102. 'requestresponse TITLE "ListUsers Request" PROMPT "Post List as a message?" GADGETS "_Yes |_No" center'
  103. select
  104.   When RC=1 then do
  105.     'write TO "'||Name||'" SUBJECT "'||Subject||'" ORIGIN "'||Origin||'" FILE "'||FilePath||'" REFLOW=OFF NOEDIT NOGUI'
  106.     End
  107. Otherwise
  108.   End
  109. 'requestnotify PROMPT "User Index compiled."'
  110. 'gotomessage TO "'CurrentMessage'"'
  111. 'unlockgui'
  112. Exit 0
  113.  
  114.